package com.xxl.job.executor.enums;


import java.util.Arrays;
import java.util.Collections;
import java.util.List;

/**
 * ClassName  : BinarySearch
 * Author     : Draghu
 * Date       : Create in 2019/12/4
 * Description: 站级接口枚举
 * <p>
 * fileSign         :
 * className        :
 * hbaseName        :
 * tableName        :
 * primaryKey       :
 */

public enum TollgateReflectEnum {
    BInList("BINLIST", "BInList", "BInList", "BASIC_BINLIST_HJ_TOPIC", Collections.singletonList("ListNo"), "入口原始表"),

    BInTimeList("BINTIMELIST", "BInTimeList", "BInTimeList", "BASIC_BINTIMELIST_HJ_TOPIC", Collections.singletonList("ListNo"), "入口时效表"),

    BInSpEventList("BINSPEVENTLIST", "BInSpEventList", "BInSpEventList", "BASIC_BINSPEVENTLIST_HJ_TOPIC", Collections.singletonList("ListNo"), "入口特殊事件表"),

    BOutList("BOUTLIST", "BOutList", "BOutList", "BASIC_BOUTLIST_HJ_TOPIC", Collections.singletonList("ListNo"), "出口原始表"),

    BOutTimeList("BOUTTIMELIST", "BOutTimeList", "BOutTimeList", "BASIC_BOUTTIMELIST_HJ_TOPIC", Collections.singletonList("ListNo"), "出口时效表"),

    BOutSpEventList("BOUTSPEVENTLIST", "BOutSpEventList", "BOutSpEventList", "BASIC_BOUTSPEVENTLIST_HJ_TOPIC", Collections.singletonList("ListNo"), "出口特殊事件表"),

    ETCBInList("ETCBINLIST", "ETCBInList", "ETCBInList", "BASIC_ETCBINLIST_HJ_TOPIC", Collections.singletonList("ListNo"), "ETC入口原始表"),

    ETCBInSpEventList("ETCBINSPEVENTLIST", "ETCBInSpEventList", "ETCBInSpEventList", "BASIC_ETCBINSPEVENTLIST_HJ_TOPIC", Collections.singletonList("ListNo"), "ETC入口特殊事件表"),

    ETCBOutList("ETCBOUTLIST", "ETCBOutList", "ETCBOutList", "BASIC_ETCBOUTLIST_HJ_TOPIC", Collections.singletonList("ListNo"), "ETC出口原始表"),

    ETCBOutSpEventList("ETCBOUTSPEVENTLIST", "ETCBOutSpEventList", "ETCBOutSpEventList", "BASIC_ETCBOUTSPEVENTLIST_HJ_TOPIC", Collections.singletonList("ListNo"), "ETC出口特殊事件表"),

    BStatusList("BSTATUSLIST", "BStatusList", "BStatusList", "BASIC_BSTATUSLIST_HJ_TOPIC", Collections.singletonList("ListNo"), "车道状态表"),

    BLaneSquad("BLANESQUAD", "BLaneSquad", "BLaneSquad", "BASIC_BLANESQUAD_HJ_TOPIC", Arrays.asList("ListNo", "StationNo", "SquareNo", "LaneNo"), "车道工班表"),

    BETCLaneContrast("BETCLANECONTRAST", "BETCLaneContrast", "BETCLaneContrast", "BASIC_BETCLANECONTRAST_HJ_TOPIC", Collections.singletonList("ListNo"), "ETC车道对账表"),

    PbaojiaoSplitInfo("PBAOJIAOSPLITINFO", "PbaojiaoSplitInfo", "PbaojiaoSplitInfo", "BASIC_PBAOJIAOSPLITINFO_HJ_TOPIC", Collections.singletonList("ListNo"), "票证室特种票表"),

    ETCScontrast("ETCSCONTRAST", "ETCScontrast", "ETCScontrast", "BASIC_ETCSCONTRAST_HJ_TOPIC", Collections.singletonList("ListNo"), "ETC对账表（四和、信通）"),

    ETCSContrastNew("ETCSCONTRASTNEW", "ETCSContrastNew", "ETCSContrastNew", "BASIC_ETCSCONTRASTNEW_HJ_TOPIC",  Collections.singletonList("ListNo"), "ETC对账表"),

    SContrast("SCONTRAST", "SContrast", "SContrast", "BASIC_SCONTRAST_HJ_TOPIC", Collections.singletonList("ListNo"), "MTC对账表（四和、信通）"),

    SContrastNew("SCONTRASTNEW", "SContrastNew", "SContrastNew", "BASIC_SCONTRASTNEW_HJ_TOPIC", Collections.singletonList("ListNo"), "对账表"),

    SSplitsum("SSPLITSUM", "SSplitsum", "SSplitsum", "BASIC_SSPLITSUM_HJ_TOPIC", Arrays.asList("LISTNO", "STATIONNO", "SQUADDATE", "OPTIME"), "拆分汇总表"),

    TblQxsjzInShiftMiddle("TBLQXSJZINSHIFTMIDDLE", "TblQxsjzInShiftMiddle", "TblQxsjzInShiftMiddle", "BASIC_TBLQXSJZINSHIFTMIDDLE_HJ_TOPIC", Collections.singletonList("listno"), "b59入口值班全表"),

    TblQxsjzOutShiftMiddle("TBLQXSJZOUTSHIFTMIDDLE", "TblQxsjzOutShiftMiddle", "TblQxsjzOutShiftMiddle", "BASIC_TBLQXSJZOUTSHIFTMIDDLE_HJ_TOPIC", Collections.singletonList("listno"), "b60出口值班全表数据表结构"),

    TblPiaoJugl("TBLPIAOJUGL", "TblPiaoJugl", "TblPiaoJugl", "BASIC_TBLPIAOJUGL_HJ_TOPIC", Arrays.asList("listno", "squaddate", "stationno", "squadno"), "票据管理信息表"),

    TblQxsjzShiftMiddleETC("TBLQXSJZSHIFTMIDDLEETC", "TblQxsjzShiftMiddleETC", "TblQxsjzShiftMiddleETC", "BASIC_TBLQXSJZSHIFTMIDDLEETC_HJ_TOPIC", Collections.singletonList("ListNo"), "b61ETC值班全表"),

    TblSPVehKindToll("TBLSPVEHKINDTOLL", "TblSPVehKindToll", "TblSPVehKindToll", "BASIC_TBLSHIFTMIDDLEETC_HJ_TOPIC", Collections.singletonList("listno"), "免费车辆汇表"),

    TblJtbFreeHourbb("TBLJTBFREEHOURBB", "TblJtbFreeHourbb", "TblJtbFreeHourbb", "BASIC_TBLJTBFREEHOURBB_HJ_TOPIC", Collections.singletonList("ListNo"), "交通部免费车小时报表"),

    GrantryTransMain("GRANTRYTRANSMAIN", "GrantryTransMain", "GrantryTransMain", "BASIC_GRANTRYTRANSMAIN_HJ_TOPIC", Collections.singletonList("tradeId"), "门架交易记录表"),

    GrantryTransMatch("GRANTRYTRANSMATCH", "GrantryTransMatch", "GrantryTransMatch", "BASIC_GRANTRYTRANSMATCH_HJ_TOPIC", Collections.singletonList("tradeId"), "ETC门架图像匹配记录表"),

    ContrastGrantryHour("CONTRASTGRANTRYHOUR", "ContrastGrantryHour", "ContrastGrantryHour", "BASIC_CONTRASTGRANTRYHOUR_HJ_TOPIC", Collections.singletonList("collectId"), "门架对账表（小时）"),

    ContrastStationDay("CONTRASTSTATIONDAY", "ContrastStationDay", "ContrastStationDay", "BASIC_CONTRASTSTATIONDAY_HJ_TOPIC", Collections.singletonList("ID"), "收费站对账表（天）"),

    ContrastGrantryDay("CONTRASTGRANTRYDAY", "ContrastGrantryDay", "ContrastGrantryDay", "BASIC_CONTRASTGRANTRYDAY_HJ_TOPIC", Collections.singletonList("collectId"), "门架对账表（天）"),

    GrantryIdentfyImages("GRANTRYIDENTFYIMAGES", "GrantryIdentfyImages", "ContrastGrantryDay", "BASIC_GRANTRYIDENTFYIMAGES_HJ_TOPIC", Collections.singletonList("picId"), "门架图片记录表"),

    LaneIdentfyImages("LANEIDENTFYIMAGES", "LaneIdentfyImages", "LaneIdentfyImages", "BASIC_LANEIDENTFYIMAGES_HJ_TOPIC", Collections.singletonList("listno"), "过车图像记录表"),

    GrantryFit("GRANTRYFIT", "GrantryFit", "GrantryFit", "BASIC_GRANTRYFIT_HJ_TOPIC", Collections.singletonList("ID"), "基于路径拟合记录表"),

    PassMutiprovinceMtcOut("PASSMUTIPROVINCEMTCOUT", "PassMutiprovinceMtcOut", "PassMutiprovinceMtcOut", "BASIC_PASSMUTIPROVINCEMTCOUT_HJ_TOPIC", Collections.singletonList("ID"), "多省通行的MTC车辆记录表"),

    GrantryIdentfyVehicleid("GRANTRYIDENTFYVEHICLEID", "GrantryIdentfyVehicleid", "GrantryIdentfyVehicleid", "BASIC_GRANTRYIDENTFYVEHICLEID_HJ_TOPIC", Collections.singletonList("picId"), "门架牌识记录表"),

    BLaneLog("BLANELOG", "BLaneLog", "BLaneLog", "BASIC_BLANELOG_HJ_TOPIC", Collections.singletonList("listno"), "日志记录表"),

    GantryBaseInfo("GANTRYBASEINFO", "GantryBaseInfo", "GantryBaseInfo", "BASIC_GANTRYBASEINFO_HJ_TOPIC", Collections.singletonList("infoVersion"), "门架基础信息"),

    GrantryEquipmentState("GRANTRYEQUIPMENTSTATE", "GrantryEquipmentState", "GrantryEquipmentState", "BASIC_GRANTRYEQUIPMENTSTATE_HJ_TOPIC", Arrays.asList("heatVersion", "chargeUnitId"), "ETC门架运行状态"),

    GraytryEvent("GRAYTRYEVENT", "GraytryEvent", "GraytryEvent", "BASIC_GRAYTRYEVENT_HJ_TOPIC", Arrays.asList("eventId", "gantryId", "eventTime"), "ETC门架异常信息"),

    TransPacklog("TRANSPACKLOG", "TransPacklog", "TransPacklog", "BASIC_TRANSPACKLOG_HJ_TOPIC", Collections.singletonList("LISTNO"), "打包上传记录表"),

    TransPacklogError("TRANSPACKLOGERROR", "TransPacklogError", "TransPacklogError", "BASIC_TRANSPACKLOGERROR_HJ_TOPIC", Collections.singletonList("LISTNO"), "打包上传错误记录"),

    GantryVehicleCount("GANTRYVEHICLECOUNT", "GantryVehicleCount", "GantryVehicleCount", "BASIC_GANTRYVEHICLECOUNT_HJ_TOPIC", Collections.singletonList("ID"), "过车汇总集合信息"),

    GantryVehicleMonitor("GANTRYVEHICLEMONITOR", "GantryVehicleMonitor", "GantryVehicleMonitor", "BASIC_GANTRYVEHICLEMONITOR_HJ_TOPIC", Collections.singletonList("serialNo"), "车检器流水信息"),

    GantryVehicleDetail("GANTRYVEHICLEDETAIL", "GantryVehicleDetail", "GantryVehicleDetail", "BASIC_GANTRYVEHICLEDETAIL_HJ_TOPIC", Collections.singletonList("ListNo"), "车检器过车明细信息"),

    GrantryFailData("GRANTRYFAILDATA", "GrantryFailData", "GrantryFailData", "BASIC_GRANTRYFAILDATA_HJ_TOPIC", Collections.singletonList("ID"), "数据入库失败记录表"),

    GrantryRespondFile("GRANTRYRESPONDFILE", "GrantryRespondFile", "GrantryRespondFile", "BASIC_GRANTRYRESPONDFILE_HJ_TOPIC", Collections.singletonList("ID"), "文件传输记录表"),

    MonitorLaneHeartbeat("MONITORLANEHEARTBEAT", "MonitorLaneHeartbeat", "MonitorLaneHeartbeat", "BASIC_MONITORLANEHEARTBEAT_HJ_TOPIC", Arrays.asList("ID", "laneSign", "spcRateVersion"), "收费车道心跳数据表"),

    MonitorLanePassList("MONITORLANEPASSLIST", "MonitorLanePassList", "MonitorLanePassList", "BASIC_MONITORLANEPASSLIST_HJ_TOPIC", Arrays.asList("ID", "laneSign"), "车道实时过车监测数据");




    /**
     * 接口唯一标识
     */
    private String fileSign;

    /**
     * 接口实体类名
     */
    private String className;

    /**
     * 接口hbase映射实体类名
     */
    private String hbaseName;

    /**
     * 接口表主键
     */
    private List<String> primaryKeys;

    /**
     * 汇聚接口kafka topic
     */
    private String kafkaHJTopic;

    /**
     * 接口描述
     */
    private String description;

    TollgateReflectEnum(String fileSign, String className, String hbaseName, String kafkaHJTopic, List<String> primaryKeys, String description) {
        this.fileSign = fileSign;
        this.className = className;
        this.hbaseName = hbaseName;
        this.kafkaHJTopic = kafkaHJTopic;
        this.primaryKeys = primaryKeys;
        this.description = description;
    }

    public String getFileSign() {
        return fileSign;
    }

    public String getClassName() {
        return className;
    }

    public String getHbaseName() {
        return hbaseName;
    }

    public String getKafkaHJTopic() {
        return kafkaHJTopic;
    }

    public List<String> getPrimaryKeys() {
        return primaryKeys;
    }

    public String getDescription() {
        return description;
    }


    public static String getClassNameByFileSign(String fileSign) {
        for (TollgateReflectEnum tollgateReflectEnum : TollgateReflectEnum.values()) {
            if (tollgateReflectEnum.getFileSign().equals(fileSign)) {
                return tollgateReflectEnum.getClassName();
            }
        }
        return null;
    }

    public static TollgateReflectEnum getEnumByFileSign(String fileSign) {
        for (TollgateReflectEnum tollgateReflectEnum : TollgateReflectEnum.values()) {
            if (tollgateReflectEnum.getFileSign().equals(fileSign)) {
                return tollgateReflectEnum;
            }
        }
        return null;
    }

    public static String getDescriptionByClassName(String className) {
        for (TollgateReflectEnum tollgateReflectEnum : TollgateReflectEnum.values()) {
            if (tollgateReflectEnum.getClassName().equals(className)) {
                return tollgateReflectEnum.getDescription();
            }
        }
        return null;
    }

    public static List<String> getFailRespSpecField(String className) {

        for (TollgateReflectEnum tollgateReflectEnum : TollgateReflectEnum.values()) {
            if (tollgateReflectEnum.getClassName().equals(className)) {
                return tollgateReflectEnum.getPrimaryKeys();
            }
        }
        return Collections.singletonList("ListNo");
    }

}
